const path = require("path");
const express = require("express");
const filmList = require("./data");
const app = express();
// 1- 使用静态资源目录
// app.use(express.static(__dirname))

// 2- 直接将渲染的内容放置到响应体
app.get("/",(req,res)=>{
	res.send((`
		<!DOCTYPE html>
		<html lang="en">
		<head>
			<meta charset="UTF-8">
			<title>渲染数据</title>
		</head>
		<body>
			${filmList.map(item=>(`
				<div>
					<h3>${item.nm}</h3>
					<img height="200" src="${item.img}"/>
				</div>
				<hr/>
			`)).join("")}
		</body>
		</html>
	`));
})
app.listen(80,()=>{
	console.log("success");
})
